package cc.telecomdigital.tdstock.Framework.UniqueItem;

import android.util.Log;

public class TDStockLog
{
	public enum DEBUG_LVL
	{ 
		VERBOSE(0),
		DEBUG(1),
		INFO(2),
		WARNING(3),
		ERROR(4),
		SILENT(5);

		public final int id;
		
		DEBUG_LVL(int iId)
		{
			id = iId;
		}

		public int getValue()
		{
			return id;
		}

		public int Compare(DEBUG_LVL iLvl)
		{
			if (id > iLvl.getValue())
				return 1;

			if (id < iLvl.getValue())
				return -1;
			
			return 0;
		}
	};
	
	private static DEBUG_LVL debugLevel = DEBUG_LVL.ERROR;
	
	public static void SetDebugLevel(DEBUG_LVL iNewLevel)
	{
		debugLevel = iNewLevel;
		
	}
	
	//Verbo Log
	public static void v(String iModule, String iMessage)
	{
		if (debugLevel.Compare(DEBUG_LVL.VERBOSE) <= 0)
			Log.v(iModule, iMessage);
	}	
	
	//Verbo Log
	public static void v(String iModule, String iMessage, Throwable iThrowException)
	{
		if (debugLevel.Compare(DEBUG_LVL.VERBOSE) <= 0)
			Log.v(iModule, iMessage, iThrowException);
	}
	
	//Debug Log
	public static void d(String iModule, String iMessage)
	{
		if (debugLevel.Compare(DEBUG_LVL.DEBUG) <= 0)
			Log.d(iModule, iMessage);
	}
	
	//Debug Log
	public static void d(String iModule, String iMessage, Throwable iThrowException)
	{
		if (debugLevel.Compare(DEBUG_LVL.DEBUG) <= 0)
			Log.d(iModule, iMessage, iThrowException);
	}	
	
	//Information Log
	public static void i(String iModule, String iMessage)
	{
		if (debugLevel.Compare(DEBUG_LVL.INFO) <= 0)
			Log.i(iModule, iMessage);
	}
	
	//Information Log
	public static void i(String iModule, String iMessage, Throwable iThrowException)
	{
		if (debugLevel.Compare(DEBUG_LVL.INFO) <= 0)
			Log.i(iModule, iMessage, iThrowException);
	}	
	
	//Warning Log
	public static void w(String iModule, String iMessage)
	{
		if (debugLevel.Compare(DEBUG_LVL.WARNING) <= 0)
			Log.d(iModule, iMessage);
	}
	
	//Warning Log
	public static void w(String iModule, String iMessage, Throwable iThrowException)
	{
		if (debugLevel.Compare(DEBUG_LVL.WARNING)  <= 0)
			Log.d(iModule, iMessage, iThrowException);
	}	
	
	//errro Log
	public static void e(String iModule, String iMessage)
	{
		if (debugLevel.Compare(DEBUG_LVL.ERROR) <= 0)
			Log.e(iModule, iMessage);		
	}
	
	//errro Log
	public static void e(String iModule, String iMessage, Throwable iThrowException)
	{
		if (debugLevel.Compare(DEBUG_LVL.ERROR) <= 0)
			Log.e(iModule, iMessage, iThrowException);
	}				
}
